package com.ship.dispatch.bean;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ship.common.core.base.ContractBaseBean;
import com.ship.common.core.base.Joinable;
import com.ship.common.core.mapping.Label;
import com.ship.common.core.mapping.SearchItem;
import com.ship.common.core.mapping.TableColumn;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

@TableName("con_broker")
@Data
public class ConBroker extends ContractBaseBean implements Joinable {

    /**
     * 合同名称
     */
    @Label(value="合同名称",multiSelect = true)
    @TableColumn
    private String contractName;

    /**
     * 合同编号
     */
    @Label(value="合同编号")
    @TableColumn
    private String contractNumber;

    /**
     * 合作方·海油
     */
    @Label(value="合作方·海油")
    @SearchItem
    @TableColumn
    private String partnerA;

    /**
     *到期时间
     */
    @Label(value="到期时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @TableColumn
    private Date expirationDate;

    /**
     * 合作方 B
     */
    @Label(value="合作方B")
    @SearchItem
    @TableColumn
    private String partnerB;

    /**
     * 贸易主体
     */
    @Label(value="贸易主体",enumContent = "贸易主体",multiSelect = true)
    @TableColumn
    private Integer tradeBody;

    /**
     * 服务费率
     */
    @Label(value="服务费率")
    private BigDecimal serviceRate;

    @Label(value="服务费率")
    @TableColumn
    @TableField(exist = false)
    private String serviceRateStr;

    /**
     * 银行名称
     */
    @Label(value="银行名称")
    @TableColumn
    private String bankName;

    /**
     * 银行地址
     */
    @Label(value="银行地址")
    @TableColumn
    private String bankAddress;

    /**
     * 银行账户名称
     */
    @Label(value="银行账户名称")
    @TableColumn
    private String bankAccountName;

    /**
     * 银行账户号码
     */
    @Label(value="银行账户号码")
    @TableColumn
    private String bankAccountNumber;

    /**
     * IBAN
     */
    @Label(value="IBAN")
    @TableColumn
    private String iban;

    /**
     * Swift Number
     */
    @Label(value="Swift Number")
    @TableColumn
    private String swiftNumber;

    /**
     * 海油联系人邮箱
     */
    @Label(value="海油联系人邮箱")
    @TableColumn
    private String contactEmail;

    /**
     * 状态(已签订、执行中、已完成)
     */
    @Label(value="状态",enumContent = "经纪人合同状态")
    @SearchItem
    @TableColumn
    private Integer status;

    /**
     *删除申请
     */
    @Label(value="删除申请",boolContent = true)
    private Boolean delApply;

    /**
     * 附件地址
     */
    @TableField(exist = false)
    private String filePath;

    /**
     *优秀案例
     */
    @Label(value="优秀案例",enumContent = "是否是优秀案例")
    private Integer excellent;

    /**
     * 签订日期
     */
    @Label(value="签订日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date signingDate;

    public String getServiceRateStr(){
        BigDecimal serviceRate = getServiceRate().stripTrailingZeros();
        String result = serviceRate+"%";
        return result;
    }

    @Override
    public String getLabel() {
        return null;
    }

    @Override
    public String getValue() {
        return null;
    }
}
